﻿using Newtonsoft.Json;

namespace PushTask
{
    /// <summary>
    /// ios 发送数据格式
    /// </summary>
    public class IosData
    {
        public IosData(string alert, string category, string badge = null, string sound = null)
        {
            this.aps = new aps();
            aps.alert = alert;
            aps.category = category;
            aps.badge = badge;
            aps.sound = sound;
        }
        /// <summary>
        /// json默认只序列化public 属性
        /// </summary>
        public aps aps { get; set; }
        public override string ToString()
        {
            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore,
            };
            return JsonConvert.SerializeObject(this, settings);
        }
    }
    public class aps
    {
        public string alert { get; set; }
        public string badge { get; set; }
        public string category { get; set; }
        public string sound { get; set; }
    }

    /// <summary>
    /// android 數據格式
    /// </summary>
    public class AndroidData
    {
        public AndroidData(string alert, string data, string badge = null, string sound = null)
        {
            this.alert = alert;
            this.data = data;
            this.badge = badge;
            this.sound = sound;
        }
        public string alert { get; set; }
        public string data { get; set; }
        public string badge { get; set; }
        public string sound { get; set; }

        public override string ToString()
        {
            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore,
            };
            return JsonConvert.SerializeObject(this, settings);
        }
    }

    public class SignalrData
    {
        public string content { get; set; }
        public object data { get; set; }
        public int mid { get; set; }
        public override string ToString()
        {
            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore,
            };
            return JsonConvert.SerializeObject(this, settings);
        }
    }

    public class DeviceData
    {
        public int Id { get; set; }
        public string DeviceStr { get; set; }
    }
}
